package com.after.saas.client.service;

import com.after.saas.client.service.factory.UserServiceHystrixFactory;
import com.after.saas.common.constants.Result;
import com.after.saas.common.constants.ServiceNameEnum;
import com.after.saas.common.model.bo.UserBO;
import com.after.saas.common.model.query.UserQuery;
import com.after.saas.common.model.vo.UserVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(contextId = "userService", value = ServiceNameEnum.USER_SERVICE, fallbackFactory = UserServiceHystrixFactory.class)
public interface RemoteUserService {

    @PostMapping("/user/batchSave")
    Result<Boolean> batchSave(@RequestBody List<UserBO> userBOS);

    @GetMapping(value = "/user/findOne")
    Result findOne(@SpringQueryMap UserQuery query);

    @PostMapping(value = "/user/page")
    Result<Page<UserVO>> queryByPage(@RequestBody UserQuery query);

    @PostMapping(value = "/user/list")
    Result<List<UserVO>> list(@RequestBody UserQuery query);

    @GetMapping(value = "/user/findById")
    Result<UserVO> findById(@RequestParam(value = "id") Long id);
}
